package com.woniuxy.dao;

import com.woniuxy.dto.CarRepairDto;
import com.woniuxy.entity.CarRepair;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Map;

@Mapper
public interface CarRepairMapper {
    /**
     * 条件查询分页查询所有
     * @param
     * @param
     */
    List<CarRepairDto> findAll(Map<String,Object> condition);

    /**
     * 添加
     */
    @Insert("insert into car_repair values(null,#{maintenanceDate},#{maintenanceGrade},#{maintenanceAmount},#{operatingMileage},#{maintenanceState},#{causeFailure},#{carId})")
    int save(CarRepair carRepair);

    /**
     * 修改
     */
    int updateById(CarRepair carRepair);
    /**
     * 删除
     */
    @Delete("delete from car_repair where id=#{id}")
    int deleteById(Integer id);
    /**
     * 批量删除
     */
    int deleteBatch(@Param("ids") String[] ids);
    /**
     * 批量添加数据
     */
    int insertBatch(List<CarRepairDto> carRepairList);
}
